<!--
 * @Description: 
 * @Author: mmzhang
 * @Date: 2022-11-21 10:48:14
 * @LastEditTime: 2022-12-08 15:15:30
-->
<template>
  <dt-modal-info ref="info" :title="title" :width="1000">
    <div class="dao" v-if="showBtn"><Button type="primary" @click="logPageExport">导出</Button></div>
    <dt-grid ref="table" page :onFetch="onFetch" :height="400" />
  </dt-modal-info>
</template>

<script>
  import columnOpt from './opt/operationRecordColumn'
  import operationMgr from '@/biz/operationLog/operationLog'
  export default {
    data() {
      return {
        title: '操作日志',
        source: '',
        code: '',
        buildIngId: '',
        params: null
      }
    },
    props: {
      showBtn: {
        type: Boolean,
        default: true
      }
    },
    methods: {
      logPageExport() {
        operationMgr.logPageExport(this.params)
      },
      onFetch(data) {
        let params = {
          ...data,
          logModule: this.code,
          buildIngId: this.buildIngId
        }
        this.params = params
        return operationMgr.logPage(params).then((res) => {
          return res
        })
      },
      show(source, code, buildIngId, logTypeSource) {
        if (source == 'export_customerBig') {
          this.title = '导出日志'
        } else {
          this.title = '操作日志'
        }
        this.buildIngId = buildIngId
        this.code = code
        this.source = source
        this.$refs.table.init(this, new columnOpt(this, source, logTypeSource))
        this.$refs.table.fetch()
        this.$refs.info.show()
      },
      hide() {
        this.$refs.info.hide()
      }
    }
  }
</script>

<style lang="scss" scoped>
  .dao {
    display: flex;
    justify-content: end;
  }
</style>
